package dev.pda.display.data.common.exceptions

import dev.pda.display.data.common.entity.ErrorResponse

open class HttpException (private val response: ErrorResponse) : Exception() {

    companion object {
        const val UNKNOWN_ERROR = "Unknown error"

        const val CODE_USER_NOT_EXIT = "100003"
        const val CODE_USER_DISABLE = "100007"
        const val CODE_LOGIN_OTHER_DEVICE = "100008"
        const val CODE_TOKEN_EXPIRED = "100009"
        const val MAINTENANCE_ERROR_CODE = "300001"
    }

    fun getErrorMessage(): String? {
        return response.message
    }

    fun getErrorCode(): String? {
        return response.code
    }
}

class ApiException(response: ErrorResponse) : HttpException(response)
class NetWorkException(response: ErrorResponse) : HttpException(response)
class MessageException(response: ErrorResponse) : HttpException(response)
